using UnityEngine;
using System.Collections;

public class Checkpoint : MonoBehaviour 
{
	public Vector3 respawnPosition;
	public GameObject character;
	
	void Start () 
	{
		character = GameObject.FindWithTag("Player");
		respawnPosition = character.transform.position;
	}

	void OnTriggerStay(Collider other)
	{
		if(other.gameObject.tag == "Player")
		{
			respawnPosition = other.gameObject.transform.position;
		}
	}
	
	public Vector3 getPosition()
	{
		return respawnPosition;
	}
}
